import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
	  third_name:getCookie('third_name'),
	  allColor:{},
	  titleText:'',
	  total:0,
	  total2:0,
	  showFileList:[],
	  carrerTouScroll:{
		  height1:0,
		  height2:0,
		  height3:0,
		  height4:0
	  },
	  domHeight:{
		  topBar:0,
		  tabTop:0,
		  tabbar:0
	  },
	  _tmpBigId:'',
	  record:'',
	  once:''
  },	  
  mutations: {
	  setOnce(state, payload){
		  state.once = payload
	  },
	  setRecord(state, payload){
		  state.record = payload
	  },  
	  setTmpBigId (state, payload){
		  state._tmpBigId = payload
	  },
	  setDomHeight (state, payload){
		  state.domHeight.topBar = payload
	  },
	  setDomHeight2 (state, payload){
	  		  state.domHeight.tabTop = payload
	  },
	  setDomHeight3 (state, payload){
	  		  state.domHeight.tabbar = payload
	  },
	  setCarrerTouScroll (state, payload) { 
		  state.carrerTouScroll.height1 = payload
	  },
	  setCarrerTouScroll2 (state, payload) {
	  		  state.carrerTouScroll.height2 = payload
	  },
	  setCarrerTouScroll3 (state, payload) {
	  		  state.carrerTouScroll.height3 = payload
	  },
	  setCarrerTouScroll4 (state, payload) {
	  		  state.carrerTouScroll.height4 = payload
	  },
	  getColor(state,color={}){
		  state.allColor = {
			  ...color
		  }
	  },
	  changTotal(state,num){
		  state.total = num
	  },
	  changTotal2(state,num){
		  state.total2 = num
	  },
	  changeShowFile(state,num){
		  state.showFileList = num
	  }
  },
  actions: {},
  modules: {}
});

function getCookie(cookieName) {
	var strCookie = document.cookie;
	var arrCookie = strCookie.split("; ");
	for (var i = 0; i < arrCookie.length; i++) {
		var arr = arrCookie[i].split("=");
		if (cookieName == arr[0]) {
			return arr[1];
		}
	}
	return "";
}